<?php
require_once('jsonobject.class.php');
date_default_timezone_set('EST');

$json_in ='{"":"Blank","A":"a","B":"b","C":"c"}';
echo "json string: ". $json_in . "<BR/>";

$a = json_decode($json_in);
$b = json_decode($json_in, true);

echo 'print_r() output<HR/>An array with an empty key:<pre>' . print_r($b, true) . "</pre><BR/><BR/>\n\n";
echo 'Has the correct keys returned from array_keys:' . print_r(array_keys($b), true);


$b_as_object = (object) $b;
echo echo_output($b_as_object, "<HR/>Standard Object Casting:<BR/>\n");
echo '<BR/>Has the correct keys returned: ' . print_r($b_as_object, true);
echo '<BR/>But throws: Notice: /home/mpcm/public_html/jsonobject/branches/example.php line 24 - Illegal member variable name';

$b_as_jsonobject = new jsonObject($b);
echo echo_output($b_as_jsonobject, "<BR/><BR/><BR/>\n\n<HR/>jsonObject Instance:<BR/>\n");
echo '<BR/>Has the correct keys returned:<BR/>' . print_r($b_as_jsonobject, true);

function echo_output($c, $s = ''){
	foreach($c as $k=>$v){
		$s .= "[$k] =>". $c->{$k} ."<BR/>\n";
	}
	return $s;
}



?>